package com.neusoft.service.impl;

import com.neusoft.mapper.PointMapper;
import com.neusoft.po.PointLog;
import com.neusoft.po.PointTrans;
import com.neusoft.service.PointService;
import com.neusoft.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class PointServiceImpl implements PointService {

    @Autowired
    PointMapper pointMapper;
    @Override
    public List<PointTrans> listPointTransByUserId(String userId) {
        return pointMapper.listPointTransByUserId(userId);
    }

    @Override
    public int savePointTrans(PointTrans pointTrans) {
        return pointMapper.savePointTrans(pointTrans);
    }

    @Override
    public int getPointLogByUserIdByTime(String userId) {
        return pointMapper.getPointLogByUserIdByTime(userId);
    }

    @Override
    public int savePointLogByPay(PointLog pointLog) {
        return pointMapper.savePointLogByPay(pointLog);
    }

    @Override
    public int deletePointLogByUserIdByTime(String userId, Integer count) {
        return pointMapper.deletePointLogByUserIdByTime(userId,count);
    }

    @Override
    public int updatePointLog(String userId) {
        return pointMapper.updatePointLog(userId,CommonUtil.getPreviousDate());
    }

    @Override
    public int getExpirationPointLogByUserId(String userId) {
        return pointMapper.getExpirationPointLogByUserId(userId,CommonUtil.getExpirationDate());
    }
}
